import { DateTime } from 'luxon'

export function customerSubscriptionDeleted() {
    const now = DateTime.now()
    const oneWeekAgo = now.minus({ days: 7 })
    const twoWeeksAgo = now.minus({ days: 14 })

    return {
        id: 'evt_1M7iAQKXgym9ohnq1Vd688Ve',
        object: 'event',
        api_version: '2020-08-27',
        created: 1669306850,
        data: {
            object: {
                id: Cypress.env('STRIPE_SUBSCRIPTION_ID'),
                object: 'subscription',
                application: null,
                application_fee_percent: null,
                automatic_tax: {
                    enabled: false,
                },
                billing_cycle_anchor: 1669306647,
                billing_thresholds: null,
                cancel_at: oneWeekAgo.toSeconds(),
                cancel_at_period_end: true,
                canceled_at: oneWeekAgo.toSeconds(),
                collection_method: 'charge_automatically',
                created: 1668701847,
                currency: 'usd',
                current_period_end: oneWeekAgo.toSeconds(),
                current_period_start: twoWeeksAgo.toSeconds(),
                customer: Cypress.env('STRIPE_CUSTOMER_ID'),
                days_until_due: null,
                default_payment_method: 'pm_1M5AmGKXgym9ohnqCjsJ0w6f',
                default_source: null,
                default_tax_rates: [],
                description: null,
                discount: null,
                ended_at: oneWeekAgo.toSeconds(),
                items: {
                    object: 'list',
                    data: [
                        {
                            id: 'si_MooPDUyv3MdHpZ',
                            object: 'subscription_item',
                            billing_thresholds: null,
                            created: 1668701847,
                            metadata: {},
                            plan: {
                                id: 'price_1M2FhWKXgym9ohnqDY9uzwrc',
                                object: 'plan',
                                active: true,
                                aggregate_usage: null,
                                amount: 2900,
                                amount_decimal: '2900',
                                billing_scheme: 'per_unit',
                                created: 1668005786,
                                currency: 'usd',
                                interval: 'month',
                                interval_count: 1,
                                livemode: false,
                                metadata: {},
                                nickname: null,
                                product: 'prod_MlnIlne4bcx8Hd',
                                tiers_mode: null,
                                transform_usage: null,
                                trial_period_days: null,
                                usage_type: 'licensed',
                            },
                            price: {
                                id: 'price_1M2FhWKXgym9ohnqDY9uzwrc',
                                object: 'price',
                                active: true,
                                billing_scheme: 'per_unit',
                                created: 1668005786,
                                currency: 'usd',
                                custom_unit_amount: null,
                                livemode: false,
                                lookup_key: null,
                                metadata: {},
                                nickname: null,
                                product: 'prod_MlnIlne4bcx8Hd',
                                recurring: {
                                    aggregate_usage: null,
                                    interval: 'month',
                                    interval_count: 1,
                                    trial_period_days: null,
                                    usage_type: 'licensed',
                                },
                                tax_behavior: 'unspecified',
                                tiers_mode: null,
                                transform_quantity: null,
                                type: 'recurring',
                                unit_amount: 2900,
                                unit_amount_decimal: '2900',
                            },
                            quantity: 1,
                            subscription: Cypress.env('STRIPE_SUBSCRIPTION_ID'),
                            tax_rates: [],
                        },
                    ],
                    has_more: false,
                    total_count: 1,
                    url: `/v1/subscription_items?subscription=${Cypress.env(
                        'STRIPE_SUBSCRIPTION_ID'
                    )}`,
                },
                latest_invoice: 'in_1M5AmJKXgym9ohnqKk5EsFQ2',
                livemode: false,
                metadata: {},
                next_pending_invoice_item_invoice: null,
                on_behalf_of: null,
                pause_collection: null,
                payment_settings: {
                    payment_method_options: null,
                    payment_method_types: null,
                    save_default_payment_method: 'off',
                },
                pending_invoice_item_interval: null,
                pending_setup_intent: null,
                pending_update: null,
                plan: {
                    id: 'price_1M2FhWKXgym9ohnqDY9uzwrc',
                    object: 'plan',
                    active: true,
                    aggregate_usage: null,
                    amount: 2900,
                    amount_decimal: '2900',
                    billing_scheme: 'per_unit',
                    created: 1668005786,
                    currency: 'usd',
                    interval: 'month',
                    interval_count: 1,
                    livemode: false,
                    metadata: {},
                    nickname: null,
                    product: 'prod_MlnIlne4bcx8Hd',
                    tiers_mode: null,
                    transform_usage: null,
                    trial_period_days: null,
                    usage_type: 'licensed',
                },
                quantity: 1,
                schedule: null,
                start_date: twoWeeksAgo.toSeconds(),
                status: 'canceled',
                test_clock: null,
                transfer_data: null,
                trial_end: null,
                trial_start: null,
            },
        },
        livemode: false,
        pending_webhooks: 4,
        request: {
            id: null,
            idempotency_key: null,
        },
        type: 'customer.subscription.deleted',
    }
}
